package com.moody.calculator;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.moody.hibernate.domain.ReportData;

public class FinancialIndexCalculator {
	private static final Logger log = LoggerFactory.getLogger(FinancialIndexCalculator.class);

	private Map<String,Double> currentMap = new HashMap<String,Double>();     //今年
	private Map<String,Double> lastMap = new HashMap<String,Double>();		//去年
	private Map<String,Double> resultMap = new LinkedHashMap<String,Double>();
	private List<ReportData> reportDataList1;
	private List<ReportData> reportDataList2;
	
	
	public FinancialIndexCalculator(List<ReportData> reportDataList1, List<ReportData> reportDataList2){
		this.reportDataList1 = reportDataList1;
		this.reportDataList2 = reportDataList2;
	}

	//将数据存入map中，包含所有计算财务指标所需要的数据
	public void loadData(){
		if(reportDataList1!=null){
			for(ReportData  rd : reportDataList1){
				currentMap.put(rd.getReportItemNo(), rd.getItemValue());
			}
		}
		if(reportDataList2!=null){
			for(ReportData rd : reportDataList2){
				lastMap.put(rd.getReportItemNo(), rd.getItemValue());
			}
		}
	}
	
	public void computeIndex(){
		//最好是多线程处理
		FinancialIndexCalculator fic = new FinancialIndexCalculator(reportDataList1,reportDataList2);
		fic.loadData();
		Method[] methods = FinancialIndexCalculator.class.getDeclaredMethods();
		for(Method  method : methods){
			String name = method.getName();
			//抽取所有以calculate的方法，表示是计算公式
			if(name.startsWith("calculate")){
				try {
					//reportData名
					name = name.substring("calculate".length(), name.length());
					resultMap.put(name, (Double) method.invoke(fic));
					
				} catch (Exception e) {
					log.error("该项计算有误",e);
				} 
			}
		}
		int i = 1;
	}
	
	public Map<String,Double> getResultMap(){
		return resultMap;
	}
	
	/*
	 * 以下为所有的财务指标计算公式
	 */

	//判断double类型是否为0
	public Boolean isZero(Double data){
		if(data >10E-6 || data <-(10E-6))
			return false;
		else
			return true;
	}
	
	
	/*
	 * 短期偿债能力
	 */
	//流动比率
	public Double calculateFR001(){
		Double EBS003 = currentMap.get("EBS003");
		Double EBS019 = currentMap.get("EBS043");

		if(currentMap.get("EBS003")!=null && currentMap.get("EBS043")!=null && !isZero(currentMap.get("EBS043")))
			return currentMap.get("EBS003")/currentMap.get("EBS043");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	/*
	 * 此公式经过修改
	 * By Fuqiang
	 */
	//速动比率
	public Double calculateFR002(){
		Double EBS003 = currentMap.get("EBS003");
		Double EBS008 = currentMap.get("EBS008");
		Double EBS043 = currentMap.get("EBS043");
		if(EBS003!=null && EBS008!=null &&  EBS043!=null && !isZero((EBS043)))
			return (EBS003-EBS008)/EBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//现金流动负债比率a（更改为：现金比率）
	//现金比率计算公式：货币资金/流动负债
	public Double calculateFR003(){
		Double EBS005 = currentMap.get("EBS005");
		Double EBS043 = currentMap.get("EBS043");
		if(currentMap.get("EBS005")!=null && currentMap.get("EBS043")!=null && !isZero(currentMap.get("EBS043")))
			return currentMap.get("EBS005")/currentMap.get("EBS043");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//现金流动负债比率b
	public Double calculateFR004(){
		Double ECF014 = currentMap.get("ECF014");
		Double ECF035 = currentMap.get("ECF035");
		Double EBS043 = currentMap.get("EBS043");
		if(currentMap.get("ECF014")!=null && currentMap.get("ECF035")!=null 
				&& currentMap.get("EBS043")!=null && !isZero(currentMap.get("EBS043")))
			return (currentMap.get("ECF014")-currentMap.get("ECF035"))/currentMap.get("EBS043");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//现金到期债务比
	public Double calculateFR005(){

		if(currentMap.get("EBS045")!=null && currentMap.get("EBS061")!=null && currentMap.get("EBS058")!=null 
				&& currentMap.get("EBS069")!=null && !isZero(currentMap.get("EBS069")))
			return (currentMap.get("EBS045")+currentMap.get("EBS061")-currentMap.get("EBS058"))/currentMap.get("EBS069");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//净负债率
	public Double calculateFR006(){
		Double EBS045 = currentMap.get("EBS045");//短期借款
		Double EBS061 = currentMap.get("EBS061");//长期借款
		Double EBS058 = currentMap.get("EBS058");//一年内到期的非流动负债
		Double EBS005 = currentMap.get("EBS005");//货币资金
		Double EBS079 = currentMap.get("EBS069");//所有者权益
		
		if(EBS045!=null && EBS061!=null && EBS058!=null 
				&& EBS079!=null && EBS005!=null && !isZero(EBS079))
			return (EBS045+EBS061+EBS058 - EBS005)/EBS079;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//全部资本化比率
	public Double calculateFR007(){
		Double EBS045 = currentMap.get("EBS045");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS058 = currentMap.get("EBS058");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS049 = currentMap.get("EBS049");
		Double EBS069 = currentMap.get("EBS069");
		
		if(EBS045!=null && EBS061!=null && EBS058!=null && EBS064!=null && EBS049!=null 
				&& EBS069!=null && !isZero(EBS045 + EBS061 + EBS058 + EBS064 + EBS069)){
			return (EBS045 + EBS061 + EBS058 + EBS064 + EBS049 ) / 
				  (EBS045 + EBS061 + EBS058 + EBS064+EBS069);
		}
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	/*
	 * 长期偿债能力
	 */
	//资产负债率
	public Double calculateFR008(){
		if(currentMap.get("EBS068")!=null && currentMap.get("EBS041")!=null && !isZero(currentMap.get("EBS041")))
			return currentMap.get("EBS068")/currentMap.get("EBS041");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//长期资本负债率
	public Double calculateFR009(){
		Double EBS068 = currentMap.get("EBS068");
		Double EBS043 = currentMap.get("EBS043");
		Double EBS069 = currentMap.get("EBS069");
		
		if(EBS068!=null && EBS043!=null && EBS069!=null && !isZero(EBS068 - EBS043 + EBS069))
			return (EBS068 - EBS043) / (EBS068 - EBS043 + EBS069);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//有形净值与债务比率
	public Double calculateFR010(){
		Double EBS069 = currentMap.get("EBS069");
		Double EBS033 = currentMap.get("EBS033");
		Double EBS068 = currentMap.get("EBS068");
		
		if(EBS069!=null && EBS033!=null && EBS068!=null && !isZero(EBS068)){
			return (EBS069-EBS033)/EBS068;
		}else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//利息保障倍数
	//利润表中无：财务费用 
	public Double calculateFR011(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
		
		if(EIS016!=null && EIS026!=null && !isZero(EIS026)){
			return (EIS016+EIS026)/EIS026;
		}else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//偿债覆盖比率
	public Double calculateFR012(){
		Double ECF014 = currentMap.get("ECF014");
		Double EBS068= currentMap.get("EBS068");
		
		if(ECF014!=null && EBS068!=null && !isZero(EBS068)){
			return ECF014/EBS068;
		}else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	

	// 长期偿债能力，与现金流量表相关的数据  
	public Double calculateFR013(){
		Double ECF014 = currentMap.get("ECF014");
		Double EIS026 = currentMap.get("EIS026");
		
		if(ECF014!=null &&  EIS026!=null && !isZero(EIS026))
			return ECF014/EIS026;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	/*
	 * 此公式经过修改
	 * by Fuqiang
	 */
	//收入利息保障倍数
	public Double calculateFR014(){
		Double EIS001 = currentMap.get("EIS001");
		Double EIS026 = currentMap.get("EIS026");
		
		if(EIS001!=null &&  EIS026!=null && !isZero(EIS026))
			return EIS001/EIS026;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
		
//		Double EIS016 = currentMap.get("EIS016");
//		Double EIS026 = currentMap.get("EIS026");
//		Double ECF054 = currentMap.get("ECF054");
//		Double ECF055 = currentMap.get("ECF055");
//		Double ECF073 = currentMap.get("ECF073");
//		
//		Double EBS045 = currentMap.get("EBS045");
//		Double EBS049 = currentMap.get("EBS049");
//		Double EBS058 = currentMap.get("EBS058");
//		Double EBS061 = currentMap.get("EBS061");
//		Double EBS063 = currentMap.get("EBS063");
//		
//		
//		if(EIS016!=null &&  EIS026!=null &&  ECF054!=null &&  ECF055!=null &&  ECF073!=null &&  EBS045!=null
//				&&  EBS049!=null  &&  EBS058!=null &&  EBS061!=null &&  EBS063!=null && 
//				!isZero(EBS045+EBS049+EBS058+EBS061+EBS063))
//			return (EIS016+EIS026+ECF054+ECF055+ECF073)/(EBS045+EBS049+EBS058+EBS061+EBS063);
//		else{
//			log.error("数据项不存在或分母为空");
//			return null;
//		}
	}
	
	//利润债务保障倍数
	public Double calculateFR015(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
//		Double ECF054 = currentMap.get("ECF054");
//		Double ECF055 = currentMap.get("ECF055");
//		Double ECF073 = currentMap.get("ECF073");
		
		Double EBS045 = currentMap.get("EBS045");
		Double EBS049 = currentMap.get("EBS049");
		Double EBS058 = currentMap.get("EBS058");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		
		
		if(EIS016!=null &&  EIS026!=null &&    EBS045!=null &&  EBS049!=null  
				&&  EBS058!=null &&  EBS061!=null &&  EBS063!=null && 
				!isZero(EBS045+EBS049+EBS058+EBS061+EBS063))
			return (EIS016+EIS026)/(EBS045+EBS049+EBS058+EBS061+EBS063);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//单位资产长期负债
	public Double calculateFR016(){
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		Double EBS041 = currentMap.get("EBS041");
		
		if(EBS061!=null &&  EBS063!=null  &&  EBS064!=null &&  EBS065!=null &&  EBS041!=null && !isZero(EBS041))
			return (EBS061+EBS063+EBS064+EBS065)/EBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//非流动负债与收入比率  
	public Double calculateFR017(){
		Double EBS068 = currentMap.get("EBS068");
		Double EBS043 = currentMap.get("EBS043");
		Double EIS001 = currentMap.get("EIS001");
		
		if(EBS068!=null &&  EBS043!=null  &&  EIS001!=null && !isZero(EIS001))
			return (EBS068-EBS043)/EIS001;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//应收账款负债率
	public Double calculateFR018(){
		Double EBS007 = currentMap.get("EBS007");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		
		if(EBS007!=null && EBS061!=null && EBS063!=null && EBS064!=null && EBS065!=null 
				&& !isZero(EBS061+EBS063+EBS064+EBS065))
			return EBS007/(EBS061+EBS063+EBS064+EBS065);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//长期负债权益比率
	public Double calculateFR019(){
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		Double EBS069 = currentMap.get("EBS069");
		
		if(EBS069!=null && EBS061!=null && EBS063!=null && EBS064!=null && EBS065!=null 
				&& !isZero(EBS069))
			return (EBS061+EBS063+EBS064+EBS065)/EBS069;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//有息负债权益比
	public Double calculateFR082(){
		Double EBS045 = currentMap.get("EBS045");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS013 = currentMap.get("EBS013");
		Double EBS058 = currentMap.get("EBS058");
		Double EBS069 = currentMap.get("EBS069");
		
		if(EBS045!=null && EBS061!=null && EBS013!=null && EBS058!=null && EBS058!=null 
				&& !isZero(EBS069))
			return (EBS061+EBS045+EBS013+EBS058)/EBS069;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//收入与非流动负债比
	public Double calculateFR020(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
//		Double ECF054 = currentMap.get("ECF054");
//		Double ECF055 = currentMap.get("ECF055");
//		Double ECF073 = currentMap.get("ECF073");
		Double EBS068 = currentMap.get("EBS068");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EIS016!=null && EIS026!=null && EBS068!=null && EBS043!=null
				&& !isZero(EBS068-EBS043))
			return (EIS016+EIS026)/(EBS068-EBS043);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//收入负债比
	public Double calculateFR021(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
//		Double ECF054 = currentMap.get("ECF054");
//		Double ECF055 = currentMap.get("ECF055");
//		Double ECF073 = currentMap.get("ECF073");
		Double EBS043 = currentMap.get("EBS043");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		
		if(EIS016!=null && EIS026!=null &&  EBS043!=null && EBS061!=null 
				&& EBS063!=null && EBS064!=null && EBS065!=null &&
				!isZero(EBS043+EBS061+EBS063+EBS064+EBS065))
			return (EIS016+EIS026)/(EBS043+EBS061+EBS063+EBS064+EBS065);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	/*
	 * 营运能力
	 */

	//应收账款周转率
	public Double calculateFR022(){
		Double EIS001 = currentMap.get("EIS001");
		Double EBS007 = currentMap.get("EBS007");
		Double lastEIS007 = lastMap.get("EBS007");
		
		if(EIS001!=null && EBS007!=null && lastEIS007==null  && !isZero(EBS007)){
			return EIS001 / EBS007 ;
		}
		
		if(EIS001!=null && EBS007!=null && lastEIS007!=null && !isZero(EBS007+lastEIS007) )
			return EIS001 / (EBS007+lastEIS007)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//存货周转率
	public Double calculateFR023(){
		Double EIS002 = currentMap.get("EIS002");
		Double EBS008 = currentMap.get("EBS008");
		Double lastEBS008 = lastMap.get("EBS008");
		
		if(EIS002!=null && EBS008 !=null && lastEBS008 ==null && !isZero(EBS008))
			return EIS002 / EBS008;
		
		if(EIS002!=null && EBS008 !=null && lastEBS008 !=null && !isZero(EBS008+lastEBS008))
			return EIS002 / (EBS008 + lastEBS008)*2;
		else{
				log.error("数据项不存在或分母为空");
			return null;
		}
	}	
	
	//流动资产周转率
	public Double calculateFR024(){
		Double EIS001 = currentMap.get("EIS001");
		Double EBS003 = currentMap.get("EBS003");
		Double lastEBS003 = currentMap.get("EBS003");
		
		if(EIS001!=null && EBS003!=null && lastEBS003 == null && !isZero(EBS003))
			return EIS001 / EBS003;
		
		if(EIS001!=null && EBS003!=null && lastEBS003!=null && !isZero(EBS003+lastEBS003))
			return EIS001 / (EBS003 + lastEBS003)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//固定资产周转率
	public Double calculateFR025(){
		Double EIS001 = currentMap.get("EIS001");
		Double EBS020 = currentMap.get("EBS020");
		Double lastEBS020 = lastMap.get("EBS020");
		
		if(EIS001!=null && EBS020!=null && lastEBS020==null && !isZero(EBS020))
			return EIS001 / EBS020;
		
		if(EIS001!=null && EBS020!=null && lastEBS020!=null && !isZero(EBS020+lastEBS020))
			return EIS001 / (EBS020 + lastEBS020)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//总资产周转率
	public Double calculateFR026(){
		Double EIS001 = currentMap.get("EIS001");
		Double EBS041 = currentMap.get("EBS041");
		Double lastEBS041 = lastMap.get("EBS041");
		
		if(EIS001!=null && EBS041!=null && lastEBS041==null && !isZero(EBS041))
			return EIS001 / EBS041;
		
		if(EIS001!=null && EBS041!=null && lastEBS041!=null && !isZero(EBS041+lastEBS041))
			return EIS001 / (EBS041 + lastEBS041)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}	
	}
	
	//资产现金回收率 
	public Double calculateFR027(){
		Double ECF014 = currentMap.get("ECF014");
		Double EBS041 = currentMap.get("EBS041");
		Double lastEBS041 = lastMap.get("EBS041");
		
		if(ECF014!=null && EBS041!=null && lastEBS041==null && !isZero(EBS041))
			return ECF014/EBS041;
		
		if(ECF014!=null && EBS041!=null && lastEBS041!=null && !isZero(EBS041+lastEBS041))
			return ECF014/(EBS041+lastEBS041)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}	
	}
	

	//应付账款周转率
	public Double calculateFR028(){
		Double EIS002 = currentMap.get("EIS002");
		Double EBS047 = currentMap.get("EBS047");
		Double lastEBS047 = lastMap.get("EBS047");
		
		if(EIS002!=null && EBS047!=null && lastEBS047==null && !isZero(EBS047)) 
            return EIS002 / EBS047 ; 
		
		if(EIS002!=null && EBS047!=null && lastEBS047!=null && !isZero(EBS047+lastEBS047))
			return EIS002 / (EBS047 + lastEBS047)*2 ;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}

	//营运资本周转期
	public Double calculateFR029(){
		Double EBS003 = currentMap.get("EBS003");
		Double lastEBS003 = lastMap.get("EBS003");
		Double EBS019 = currentMap.get("EBS019");
		Double lastEBS019 = lastMap.get("EBS019");
		Double EIS001 = currentMap.get("EIS001");
		
		if(EBS003!=null && lastEBS003!=null && EBS019!=null && lastEBS019!=null && !isZero(EIS001))
			return (EBS003+lastEBS003-EBS019-lastEBS019)*2/EIS001;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
		
	//应收账款周转天数
	public Double calculateFR078(){
		Double FR022 = calculateFR022();
		if(FR022 == null || FR022 == 0) return null;
		else return 365 / FR022;
	}

	//应付账款周转天数
	public Double calculateFR079(){
		Double FR028 = calculateFR028();
		if(FR028 == null || FR028 == 0) return null;
		else return 365 / FR028;
	}
	
	//存货周转天数
	public Double calculateFR080(){
		Double FR023 = calculateFR023();
		if(FR023 == null || FR023 == 0) return null;
		else return 365 / FR023;
	}
	
	//总资产周转天数
	public Double calculateFR081(){
		Double FR026 = calculateFR026();
		if(FR026 == null || FR026 == 0) return null;
		else return 365 / FR026;
	}
	
	/*
	 * 盈利能力
	 */
	/*
	 * 此公式经过修改，by Fuqiang
	 */
	//总资产回报率：净利润/总资产
	public Double calculateFR030(){
		Double EIS019 = currentMap.get("EIS019");//净利润
		Double EBS041 = currentMap.get("EBS041");
//		Double lastEBS041 = lastMap.get("EBS041");
		
		if(EIS019!=null &&  EBS041!=null && !isZero(EBS041))
			return EIS019 /EBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//长期资金报酬率
	public Double calculateFR031(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		
		Double lastEBS061 = lastMap.get("EBS061");
		Double lastEBS063 = lastMap.get("EBS063");
		Double lastEBS064 = lastMap.get("EBS064");
	
		Double EBS069 = currentMap.get("EBS069");
		Double lastEBS069 = lastMap.get("EBS069");
		
		if(EIS016!=null && EIS026 !=null &&EBS061!=null && EBS064!=null &&
				EBS063!=null && EBS065!=null &&lastEBS061!=null && lastEBS063!=null
				&& lastEBS064!=null && EBS069!=null && lastEBS069!=null && 
				!isZero(EBS061 + EBS063 + EBS064 + EBS065 + lastEBS061 + lastEBS063 + lastEBS064 + EBS069 + lastEBS069))
			return (EIS016+EIS026)/(EBS061 + EBS063 + EBS064 + EBS065 + lastEBS061 + lastEBS063 + lastEBS064 + EBS069 + lastEBS069)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//净资产报酬率
	public Double calculateFR032(){
		Double EIS019 = currentMap.get("EIS019");
		Double EBS069 = currentMap.get("EBS069");
		Double lastEBS069 = lastMap.get("EBS069");
		
		if(EIS019!=null &&  EBS069!=null && lastEBS069!=null && !isZero(EBS069+lastEBS069))
			return EIS019/(lastEBS069+EBS069)*2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//主营业务毛利率(更改为：销售利润率)
	//计算公式如下：利润总额/主营业务收入(销售收入)
	public Double calculateFR033(){
		Double EIS002 = currentMap.get("EIS001");//营业收入
		Double EIS003 = currentMap.get("EIS002");//减：营业成本
		
		Double EIS016 = currentMap.get("EIS016");//利润总额
		
		if(EIS016!=null && EIS002!=null && !isZero(EIS002))
			return EIS016/EIS002;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//成本费用利润率
	public Double calculateFR034(){
		Double EBS016 = currentMap.get("EBS016");
		Double EIS003 = currentMap.get("EIS003");
		Double EIS004 = currentMap.get("EIS004");
		Double EIS005 = currentMap.get("EIS005");
		Double EIS006 = currentMap.get("EIS006");
		Double EIS026 = currentMap.get("EIS026");

		if(EBS016!=null && EIS003!=null && EIS004!=null && EIS005!=null && EIS006!=null && EIS026!=null &&
				!isZero(EIS003+EIS004+EIS005+EIS006+EIS026))
			return EBS016/(EIS003+EIS004+EIS005+EIS006+EIS026);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//资本收益率
	public Double calculateFR035(){
		Double EIS019 = currentMap.get("EIS019");
		Double EBS070 = currentMap.get("EBS070");
		Double lastEBS070 = lastMap.get("EBS070");
		Double EBS072 = currentMap.get("EBS072");
		Double lastEBS072 = lastMap.get("EBS072");
		
		if(EIS019!=null && EBS070!=null &&  lastEBS070!=null && EBS072!=null 
				&& lastEBS072!=null && !isZero(EBS070 + lastEBS070 + EBS072 + lastEBS072))
			return EIS019 / (EBS070 + lastEBS070 + EBS072 + lastEBS072) * 2;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//主营业务净利率
	public Double calculateFR036(){
		Double EIS019 = currentMap.get("EIS019");
		Double EIS001 = currentMap.get("EIS001");
		
		if(EIS019!=null && EIS001!=null && !isZero(EIS001))
			return EIS019/EIS001;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	// 现金流量表无 　4-8 折旧摊销覆盖率
	public Double calculateFR037(){
		Double EIS016 = currentMap.get("EIS016");
		Double EIS026 = currentMap.get("EIS026");
		Double ECF054 = currentMap.get("ECF054");
		Double ECF055 = currentMap.get("ECF055");
		//Double ECF073 = currentMap.get("ECF073");
		
		if(EIS016!=null && EIS026!=null && ECF054!=null && ECF055!=null  
				&& !isZero(ECF054+ECF055))
			return (ECF054+ECF055+EIS016+EIS026)/(ECF054+ECF055);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//息税前利润率:息税前利润/主营业务收入
	public Double calculateFR038(){
		Double EIS026 = currentMap.get("EIS026");//    财务费用
		Double EIS016 = currentMap.get("EIS016");//利润总额   
		Double EBS041 = currentMap.get("EIS001");//营业收入
		
		if(EIS026!=null && EIS016!=null && EBS041!=null && !isZero(EBS041))
			return (EIS016+EIS026)/EBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//单位资产利润
	public Double calculateFR039(){
		Double EIS016 = currentMap.get("EIS016");
		Double EBS041 = currentMap.get("EBS041"); 
		
		if(EIS016 !=null && EBS041 !=null && !isZero(EBS041))
			return EIS016/EBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//单位资产留存收益
	public Double calculateFR040(){
		Double EBS076 = currentMap.get("EBS076");
		Double lastEBS076 = lastMap.get("EBS076");
		Double EBS041 = currentMap.get("EBS041");
		
		if(EBS076!=null && lastEBS076 !=null && EBS041!=null && !isZero(EBS041))
			return (EBS076-lastEBS076)/EBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//净资产利润率
	public Double calculateFR041(){
		Double EIS019 = currentMap.get("EIS019");
		Double EBS069 = currentMap.get("EBS069");
		
		if(EIS019!=null &&  EBS069!=null && !isZero(EBS069))
			return EIS019/EBS069;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//经营利润与营运资金比率
	public Double calculateFR042(){
		Double EIS012 = currentMap.get("EIS012");
		Double EBS003 = currentMap.get("EBS003");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EIS012!=null &&  EBS003!=null && EBS043!=null && !isZero(EBS003-EBS043))
			return EIS012 / (EBS003-EBS043);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	/*
	 * 流动性
	 */
	//流动负债偿付比率a
	public Double calculateFR043(){
		Double EBS005 = currentMap.get("EBS005");
		Double EBS006 = currentMap.get("EBS006");
		Double EBS013 = currentMap.get("EBS013");
		Double EBS043 = currentMap.get("EBS043");
		Double EBS051 = currentMap.get("EBS051");
		
		if(EBS005!=null && EBS006!=null &&  EBS013!=null &&  EBS043!=null &&  EBS051 !=null && 
				!isZero(EBS043-EBS051))
			return (EBS005 + EBS006 + EBS013) / (EBS043 - EBS051);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//流动负债偿付比率b
	public Double calculateFR044(){
		Double EBS005 = currentMap.get("EBS005");
		Double EBS006 = currentMap.get("EBS006");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EBS005!=null && EBS006!=null && EBS043!=null && !isZero(EBS043))
			return ( EBS005 + EBS006 ) / EBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//流动负债偿付比率c
	public Double calculateFR045(){
		Double EBS005 = currentMap.get("EBS005");
		Double EBS013 = currentMap.get("EBS013");
		Double EBS043 = currentMap.get("EBS043");
		Double EBS051 = currentMap.get("EBS051");
		
		if(EBS005!=null &&  EBS013!=null &&  EBS043!=null &&  EBS051 !=null && 
				!isZero(EBS043-EBS051))
			return (EBS005 + EBS013) / (EBS043 - EBS051);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//流动负债偿付比率d
	public Double calculateFR046(){
		Double EBS005 = currentMap.get("EBS005");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EBS005!=null &&  EBS043!=null &&   !isZero(EBS043))
			return EBS005 / EBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//应收账款流动负债率
	public Double calculateFR047(){
		Double EBS007 = currentMap.get("EBS007");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EBS007!=null && EBS043!=null && !isZero(EBS043))
			return EBS007 / EBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	//速动资产负债率
	public Double calculateFR048(){
		Double EBS003 = currentMap.get("EBS003");
		Double EBS008 = currentMap.get("EBS008");
		Double EBS043 = currentMap.get("EBS043");
		
		if(EBS003!=null &&  EBS008!=null && EBS043!=null && !isZero(EBS043))
			return (EBS003 - EBS008) / EBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	/*
	 * 规模指标
	 */
	
	//主营业务收入净额规模
	public Double calculateFR049(){
		Double EIS001 = currentMap.get("EIS001");
		if(EIS001!=null)
			return EIS001;
		else
			return null;
	}
	
	//资产总计规模
	public Double calculateFR050(){
		Double EBS041 = currentMap.get("EBS041");
		if(EBS041!=null)
			return EBS041;
		else
			return null;
	}
	
	//所有者权益合计规模
	public Double calculateFR051(){
		Double EBS069 = currentMap.get("EBS069");
		if(EBS069!=null)
			return EBS069;
		else
			return null;
	}
	
	//平均主营业务收入净额规模
	public Double calculateFR052(){
		Double EIS001 = currentMap.get("EIS001");
		Double lastEIS001 = lastMap.get("EIS001");
		if(EIS001!=null && lastEIS001!=null)
			return (EIS001+lastEIS001)/2;
		else
			return null;
	}
	
	//平均资产总计规模
	public Double calculateFR053(){
		Double EBS041 = currentMap.get("EBS041");
		Double lastEBS041 = lastMap.get("EBS041");
		if(EBS041!=null && lastEBS041!=null)
			return (EBS041+lastEBS041)/2;
		else
			return null;
	}
	
	//平均所有者权益合计规模
	public Double calculateFR054(){
		Double currentEBS069 = currentMap.get("EBS069"); //当年所有者权益
		Double lastEBS069 = lastMap.get("EBS069"); //前一年所有者权益
		
		if(currentEBS069!=null && lastEBS069!=null)
			return (currentEBS069 + lastEBS069)/2;
		else 
			return null;
	}
	
	
	/*
	 * 财务结构
	 */
	
	//长期资产适合率 
	public Double calculateFR055(){
		Double currentEBS069 = currentMap.get("EBS069"); //所有者权益
		
		//以下几项和为长期负债合计
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS063 = currentMap.get("EBS063"); //应付债券
		Double currentEBS064 = currentMap.get("EBS064"); //长期应付款
		Double currentEBS065 = currentMap.get("EBS065"); //专项应付款
		
		Double currentEBS020 = currentMap.get("EBS020"); //固定资产
		
		//以下几项和为长期投资合计
		Double currentEBS021 = currentMap.get("EBS021"); //可供出售金融资产
		Double currentEBS022 = currentMap.get("EBS022"); //持有至到期投资
		Double currentEBS023 = currentMap.get("EBS023"); //投资性房地产
		Double currentEBS024 = currentMap.get("EBS024"); //长期股权投资
		Double currentEBS025 = currentMap.get("EBS025"); //长期应收款
		
		if(currentEBS069!=null &&  currentEBS061!=null &&  currentEBS063!=null && currentEBS064!=null && currentEBS065!=null &&
				currentEBS020!=null && currentEBS021!=null && currentEBS022!=null && currentEBS023!=null && currentEBS024!=null && currentEBS025!=null &&
				!isZero(currentEBS020 + currentEBS021 + currentEBS022 + currentEBS023+ currentEBS024 + currentEBS025))
			return (currentEBS069 + currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065)/
			(currentEBS020 + currentEBS021 + currentEBS022 + currentEBS023+ currentEBS024 + currentEBS025);
		else{
			log.error("分母为0");
			return null;
		}		
	}
	
	//付息债务结构比
	public Double calculateFR056(){
		
		Double currentEBS045 = currentMap.get("EBS045"); //短期借款
		Double currentEBS049 = currentMap.get("EBS049"); //应付票据
		Double currentEBS058 = currentMap.get("EBS058"); //一年内到期的非流动负债
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS063 = currentMap.get("EBS063"); //应付债券
		
		
		
		Double currentEBS068 = currentMap.get("EBS068"); //负债合计
		
		if(currentEBS045 != null && currentEBS049 != null 
				&& currentEBS058 != null && currentEBS061 != null
				&& currentEBS063 != null && currentEBS068 != null){
				Double tempItem = currentEBS045 + currentEBS049 + currentEBS058 + currentEBS061 + currentEBS063; //总债务
				if( !isZero(currentEBS068))
					return tempItem/currentEBS068;
				else
					return null;
			}
		
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//流动负债结构比
	public Double calculateFR057(){
		
		Double currentEBS043 = currentMap.get("EBS043"); //流动负债合计
		Double currentEBS068 = currentMap.get("EBS068"); //负债合计
		
		if(currentEBS043 != null && currentEBS068 != null && !isZero(currentEBS068))
			return currentEBS043/currentEBS068;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
		
	}
	
	//应付账款负债比
	public Double calculateFR058(){
		
		Double currentEBS047 = currentMap.get("EBS047"); //应付账款
		
		Double currentEBS043 = currentMap.get("EBS043"); //流动负债合计
		
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS063 = currentMap.get("EBS063"); //应付债券
		Double currentEBS064 = currentMap.get("EBS064"); //长期应付款
		Double currentEBS065 = currentMap.get("EBS065"); //专项应付款
		
		if(	currentEBS047 != null && currentEBS043 != null 
				&& currentEBS061 != null && currentEBS063 != null 
				&& currentEBS064 != null && currentEBS065 != null 
				&& !isZero(currentEBS043 + currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065))
			return currentEBS047/(currentEBS043 + currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//有形资本净值与长期负债比
	public Double calculateFR059(){
		Double currentEBS069 = currentMap.get("EBS069"); //所有者权益
		
		Double currentEBS035 = currentMap.get("EBS035"); //无形资产
		Double currentEBS036 = currentMap.get("EBS036"); //开发支出
		Double currentEBS037 = currentMap.get("EBS037"); //商誉、
		Double currentEBS038 = currentMap.get("EBS038"); //长期待摊费用
		Double currentEBS039 = currentMap.get("EBS039"); //递延所得税资产
		Double currentEBS040 = currentMap.get("EBS040"); //其他非流动资产
		
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS063 = currentMap.get("EBS063"); //应付债券
		Double currentEBS064 = currentMap.get("EBS064"); //长期应付款
		Double currentEBS065 = currentMap.get("EBS065"); //专项应付款
		
		
		if(currentEBS069 != null 
				&& currentEBS035 != null && currentEBS036 != null 
				&& currentEBS037 != null && currentEBS038 != null 
				&& currentEBS039 != null && currentEBS040 != null 
				&& currentEBS061 != null && currentEBS063 != null 
				&& currentEBS064 != null && currentEBS065 != null 
				&& !isZero(currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065 + currentEBS069))
			return (currentEBS069 - currentEBS035 - currentEBS036 - currentEBS037 - currentEBS038 - currentEBS039 - currentEBS040)/(currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065 + currentEBS069);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}		
		
	}
	
	//应收账款与总资产比率
	public Double calculateFR060(){
		if(currentMap.get("EBS007")!=null && currentMap.get("EBS041")!=null 
				&& !isZero(currentMap.get("EBS041")))
			return currentMap.get("EBS007")/currentMap.get("EBS041");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//存货与总资产比率
	public Double calculateFR061(){
		if(currentMap.get("EBS008")!=null && currentMap.get("EBS041")!=null 
				&& !isZero(currentMap.get("EBS041")))
			return currentMap.get("EBS008")/currentMap.get("EBS041");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	
	public Double calculateFR062(){
		
		if(currentMap.get("EBS041")!=null && currentMap.get("EBS003")!=null 
				&& currentMap.get("EBS069")!=null &&!isZero(currentMap.get("EBS069")))
			return (currentMap.get("EBS041")- currentMap.get("EBS003"))/currentMap.get("EBS069");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
		
	}
	
	public Double calculateFR063(){
		Double currentEIS026 = currentMap.get("EIS026"); //财务费用
		
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS045 = currentMap.get("EBS045"); //短期借款
		
		if(currentEIS026!=null && currentEBS061!=null && currentEBS045!=null && !isZero(currentEBS061 + currentEBS045))
			return currentEIS026/(currentEBS061 + currentEBS045);
		else{
			log.error("分母为0");
			return null;
		}
		
	} 
	
	public Double calculateFR064(){
		
		Double currentEBS069 = currentMap.get("EBS069"); //所有者权益
		Double currentEBS041 = currentMap.get("EBS041"); //资产总计
		Double currentEBS003 = currentMap.get("EBS003"); //流动资产合计
		Double currentEBS007 = currentMap.get("EBS007"); //应收账款
		Double currentEBS017 = currentMap.get("EBS017"); //其他应收款
		Double currentEBS014 = currentMap.get("EBS014"); //预付账款
		Double currentEBS008 = currentMap.get("EBS008"); //存货
		
		
		
		if(currentEBS069 != null && currentEBS041 != null 
			&& currentEBS003 != null && currentEBS007 != null 
			&& currentEBS017 != null && currentEBS014 != null
			&& currentEBS008 != null){
				Double tempItem = (currentEBS003 - currentEBS007 - currentEBS017 - currentEBS014 - currentEBS008);
				if(!isZero(currentEBS041 - tempItem))
					return currentEBS069/(currentEBS041 - tempItem);
				else
					return null;
			 }
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR065(){
		Double currentEBS041 = currentMap.get("EBS041"); //资产总计
		Double currentEBS003 = currentMap.get("EBS003"); //流动资产合计
		Double currentEBS061 = currentMap.get("EBS061"); //长期借款
		Double currentEBS063 = currentMap.get("EBS063"); //应付债券
		Double currentEBS064 = currentMap.get("EBS064"); //长期应付款
		Double currentEBS065 = currentMap.get("EBS065"); //专项应付款
		Double currentEBS069 = currentMap.get("EBS069"); //所有者权益
		
		if(currentEBS041 != null && currentEBS003 != null && currentEBS061 != null 
				&& currentEBS063 != null && currentEBS064 != null && currentEBS065 != null 
				&& currentEBS069 != null && !isZero(currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065 + currentEBS069))
			return (currentEBS041 - currentEBS003)/(currentEBS061 + currentEBS063 + currentEBS064 + currentEBS065 + currentEBS069);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}		
		
	}
	
	public Double calculateFR066(){
		
		if(currentMap.get("EIS004")!=null && currentMap.get("EBS008")!=null && !isZero(currentMap.get("EBS008")))
			return currentMap.get("EIS004")/currentMap.get("EBS008");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR067(){
		if(currentMap.get("EBS008")!=null && currentMap.get("EBS003")!=null && !isZero(currentMap.get("EBS003")))
			return currentMap.get("EBS008")/currentMap.get("EBS003");
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//TODO  年末贷款余额 公式无
	//净资产与年末贷款余额比率 
	public Double calculateFR068(){
		Double currentEBS069 = currentMap.get("EBS069"); //所有者权益
		return null;
	}

	/*
	 * 成长性指标
	 */
	//主营业务收入增长率
	public Double calculateFR069(){
		Double EIS001 = currentMap.get("EIS001");
		Double lastEIS001 = lastMap.get("EIS001");
		
		if(EIS001!=null && lastEIS001!=null && !isZero(lastEIS001))
			return (EIS001 - lastEIS001) / lastEIS001;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR070(){
		Double EBS041 = currentMap.get("EBS041");
		Double lastEBS041 = lastMap.get("EBS041");
		
		if(EBS041!=null && lastEBS041!=null && !isZero(lastEBS041))
			return (EBS041 - lastEBS041) / lastEBS041;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR071(){
		Double EBS069 = currentMap.get("EBS069");
		Double lastEBS069 = lastMap.get("EBS069");
		
		if(EBS069!=null && lastEBS069!=null && !isZero(lastEBS069))
			return (EBS069 - lastEBS069) / lastEBS069;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//净利润增长率
	public Double calculateFR072(){
		Double EIS019 = currentMap.get("EIS019");
		Double lastEIS019 = lastMap.get("EIS019");
		
		if(EIS019!=null && lastEIS019!=null && !isZero(lastEIS019))
			return (EIS019-lastEIS019)/lastEIS019;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR073(){
		Double EBS068 = currentMap.get("EBS068");
		Double lastEBS068 = lastMap.get("EBS068");
		
		if(EBS068!=null && lastEBS068!=null && !isZero(lastEBS068))
			return (EBS068 - lastEBS068) / lastEBS068;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR074(){
		Double EBS043 = currentMap.get("EBS043");
		Double lastEBS043 = lastMap.get("EBS043");
		
		if(EBS043!=null && lastEBS043!=null && !isZero(lastEBS043))
			return (EBS043 - lastEBS043) / lastEBS043;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR075(){
		Double EBS061 = currentMap.get("EBS061");
		Double EBS063 = currentMap.get("EBS063");
		Double EBS064 = currentMap.get("EBS064");
		Double EBS065 = currentMap.get("EBS065");
		
		Double lastEBS061 = lastMap.get("EBS061");
		Double lastEBS063 = lastMap.get("EBS063");
		Double lastEBS064 = lastMap.get("EBS064");
		Double lastEBS065 = lastMap.get("EBS065");
		
		if(EBS061!=null && EBS063!=null && EBS064!=null && EBS065!=null && lastEBS061!=null 
				&& lastEBS063!=null && lastEBS064!=null && lastEBS065!=null 
				&& !isZero(lastEBS061 + lastEBS063 + lastEBS064 + lastEBS065))
			return (EBS061 + EBS063 + EBS064 + EBS065 + lastEBS061 - lastEBS063 - lastEBS064 - lastEBS065)
				/(lastEBS061 + lastEBS063 + lastEBS064 + lastEBS065);
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	public Double calculateFR076(){
		Double EIS012 = currentMap.get("EIS012");
		Double lastEIS012 = lastMap.get("EIS012");
		
		if(EIS012!=null && lastEIS012!=null && !isZero(lastEIS012))
			return (EIS012 - lastEIS012) / lastEIS012;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	// 主营业务毛率增长率
	public Double calculateFR077() {
		Double EIS001 = currentMap.get("EIS001");
		Double EIS002 = currentMap.get("EIS002");
		Double lastEIS001 = lastMap.get("EIS001");
		Double lastEIS002 = lastMap.get("EIS002");

		if (EIS001 != null && EIS002 != null && lastEIS001 != null
				&& lastEIS002 != null
				&& !isZero(EIS001) &&!isZero(lastEIS001) &&!isZero((lastEIS001 - lastEIS002) / lastEIS001)){
			Double result = (((EIS001 - EIS002) / EIS001) - ((lastEIS001 - lastEIS002) / lastEIS001))
			/ ((lastEIS001 - lastEIS002) / lastEIS001);
			return result;
		}
			
		
		else {
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
	
	//销售毛利率：（主营业务收入-主营业务成本）/主营业务收入
	public Double calculateFR083(){
		Double EIS001 = currentMap.get("EIS001");//营业收入
		Double EIS002 = currentMap.get("EIS002");//减：营业成本
		
		
		if(EIS001!=null && EIS002!=null && !isZero(EIS001))
			return (EIS001-EIS002)/EIS001;
		else{
			log.error("数据项不存在或分母为空");
			return null;
		}
	}
}
